<template>
  <div class='shop-unit' @click="seeShopDetail">
    <div :class="ranks | formaltColor">
      <span class="iconfont icon-turned_in"></span>
      <span class="rank pa">{{ranks||1}}</span>
    </div>
    <img :src="formaltData.logo||defaultLogo" alt="" class="logo">
    <div class="info">
      <p class="name white-space">{{formaltData.name||"浙江群星风机制作有限公司"}}</p>
      <p class="intro ft12 white-space">周成交量：{{formaltData.count||"暂无"}}</p>
    </div>
    <div v-if="showIcon" class="show-icon">
      <span class="icon-huangguan iconfont color-yellow"></span>
      <span class="icon-zuanshi iconfont color-yellow"></span>
    </div>
    <img :src="formaltData.code||defaultCode" alt="" class="code">
  </div>
</template>
<script>
export default {
  props:["info","ranks",'showIcon'],
  components: {},
  name: "",
  data() {
    return {
      defaultLogo:require("@/assets/imgs/homepage/c_logo.png"),
      defaultCode:require('@/assets/imgs/homepage/popshops/code.png')
    };
  },
  filters:{
    formaltColor(ranks){
      let classname = 'rank-box pr'
      let colorArray=[
        "color-red",
        "color-yellow",
        "color-orange",
        "color-999",
        "color-999"
      ]
      return classname+" "+colorArray[ranks-1]
    }
  },
  computed:{
    formaltData(){
      return this.info
    }
  },
  methods: {
    seeShopDetail(){
      this.$router.push({
        path:"/shops",
        query:{id:1}
      })
    }
  },
  created() {}
};
</script>
<style lang="scss" scoped>
.shop-unit {
  display: flex;
  justify-content: space-between;
  height: 50px;
  font-size: 14px;
  padding: 5px 20px;

  .rank-box{
    .iconfont{
      font-size: 44px;
    }
    .rank{
      left: 50%;
      top: 40%;
      transform: translate(-50%,-50%);
      color: #333;
    }
  }

  .logo{
    width: 30px;
    height: 30px;
    margin-top: 8px;
    margin-right: 5px;
  }
  .info{
    margin-top: 4px;
    width: 140px;
    .intro{
      color: #999;
    }
  }
  .code{
    width: 40px;
    height: 40px;
  }

  .color-orange{
    color: yellowgreen;
  }

  .show-icon{
    margin-left: 5px;
    margin-top: 10px;

    .iconfont{
      margin-right: 5px;
    }
    .icon-huangguan{
      font-size: 20px;
      transform: translateY(20px)
    }
  }
}
.shop-unit:hover{
  background-color: #f5f5f5;
  cursor: pointer;
}


</style>